﻿using ChangingValidationFromAndbyAggregate.Dominio;
using NHibernate.Validator.Cfg.Loquacious;
using NHibernate.Validator.Specific.It;

namespace ChangingValidationFromAndbyAggregate.Validators
{
    public class CustomerValidation : ValidationDef<Customer>
    {
        public CustomerValidation()
        {
            // The customer must have a not empty CompanyName
            Define(e => e.CompanyName).NotNullableAndNotEmpty();

            // The customer may have VatIdentificationNumber and if he has one it must be a valid Italian’s Patita-IVA.
            Define(e => e.VatIdentificationNumber).IsPartitaIva();
        }
    }
}